package com.yangyang.ralearn.util;

import java.util.ArrayList;
import java.util.List;

public class ArrayUtil {

	public static String[] subArray(String[] data, int startIndex, int length) {
		String[] result;
		if (length == 0)
			length = data.length - startIndex;
		if (data == null || data.length == 0)
			result = new String[0];
		else {
			int size = length > data.length - startIndex ? data.length
					- startIndex : length;
			result = new String[size];
			size += startIndex;
			for (int i = startIndex; i < size; i++)
				result[i - startIndex] = data[i];
		}
		return result;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		List<Integer> a = new ArrayList<Integer>();
		a.add(1);
		a.add(2);
		List<Integer> b = a;
		a = new ArrayList<Integer>();
		System.out.println(a);
		System.out.println(b);
	}

}
